home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 4thcmp21.zip / STRINGS1.4TH < prev    next >
Text File  |  1993-06-23  |  2KB  |  64 lines

  1. \ STRING SUPPORT LIBRARY PART 1
  2. \ Contents Copyright (C) 1986, 1993 by Thomas Almy
  3.  
  4. \ Permission is granted to registered users of ForthCMP to sell or distribute
  5. \ computer programs incorporating the compiled contents of this file.
  6.  
  7. \ This file must be loaded BEFORE the application program.
  8. \ Then load STRINGS2.4TH before FORTHLIB.
  9.  
  10. \ When separate code and data segments are used, beware that
  11. \ string literals are in the code segment.  Use STR>DSEG
  12. \ to move to string buffer ( in DSEG ).
  13.  
  14.  
  15. .( Loading STRINGS ) CR
  16. 10 DECIMAL
  17.  
  18. FIND StringSize #IF DROP #ELSE
  19.  
  20. 1024 CONSTANT StringSize  \ alter if desired.
  21.  
  22. \ For instance, to have a 512 byte buffer instead of the default 1024, start
  23. \ the source file "xxx MSDOS  512 CONSTANT StringSize  INCLUDE STRINGS1".
  24.  
  25. #THEN
  26.  
  27. DSEG
  28.  
  29. FIND strbufr #IF DROP #ELSE
  30.  
  31. CREATE strbufr  StringSize ALLOT
  32. \ you might also want to put strbufr at some arbitrary high constant
  33. \ location so that the size of the COM/EXE file is not increased:
  34. \   PSIZE StringSize - 1000 ( size of stacks ) - CONSTANT strbufr
  35.  
  36.  
  37. \ While the example shows the string buffer at a fixed location, it can
  38. \ be dynamically positioned at program startup if the EQUs STRBUF and
  39. \ strend are set as well. In this case, strbufr should be declared to be an
  40. \ EQU: "xxx MSDOS  0 EQU strbufr  INCLUDE STRINGS1". In MAIN, the following
  41. \ code can be executed: "HERE DUP EQU strbufr  DUP EQU STRBUF  EQU strend
  42. \ StringSize ALLOT"
  43.  
  44. #THEN
  45.  
  46. strbufr EQU STRBUF
  47. strbufr EQU strend
  48.  
  49. 1 0 IN/OUT NEED +STRBUF
  50. 1 1 IN/OUT NEED STR>DSEG
  51. 2 0 IN/OUT NEED STRCPY
  52. 2 1 IN/OUT NEED STRPCK
  53. 1 1 IN/OUT NEED ASCIIZ
  54. 1 1 IN/OUT NEED -ASCIIZ
  55. 2 2 IN/OUT NEED -PATH
  56. 1 1 IN/OUT NEED -EXT
  57. 2 1 IN/OUT NEED +EXT
  58. 0 1 IN/OUT NEED argc
  59. 2 1 IN/OUT NEED -ASCIIZL
  60. 1 1 IN/OUT NEED argv
  61. 1 1 IN/OUT NEED getenv
  62.  
  63. 16 = #IF HEX #THEN
  64.